home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 020a / bmp2bgi1.zip / SHOWBGI.C < prev    next >
C/C++ Source or Header  |  1991-05-25  |  2KB  |  44 lines

  1. #include <stdio.h>
  2. #include <graphics.h>
  3. #include "bgi.h"
  4.  
  5. BGIPREFACE BGIHeader;                           // Header stuff for the BGI
  6.                                                 // files created w/ BMP2BGI
  7.  
  8. extern void ShowBGI(FILE *, char far *VidBuf[5]);
  9.  
  10. extern _stklen=10240;
  11.  
  12. void main(int argc, char *argv[])
  13. {
  14.   int gd = DETECT, gm;                          // BGI initgraph vars
  15.   FILE *f;                                      // BGI image file created w/ bmp2bgi.exe
  16.   char far *VidBuf[5];                          // Structure to hold BGI image
  17.  
  18.                                                 
  19.                                                 // Dopey, you forgot to tell me
  20.                                                 // what image file
  21.   if (argc != 2)
  22.   {
  23.         printf("\a\nUSAGE: showbgi FILE.BGI");
  24.         printf("\n\t where 'FILE.BGI' is the name of the BGI file");
  25.         exit (1);
  26.   }
  27.                 
  28.   registerfarbgidriver(EGAVGA_driver_far);      // Initialize graphics
  29.   initgraph(&gd, &gm, "");
  30.                                                 
  31.   f = fopen(argv[1], "rb");                     // Open the BGI file
  32.  
  33.                                                 
  34.   fread(&BGIHeader,sizeof(BGIHeader), 1, f);    // Read in the BGI header
  35.                                             
  36.   ShowBGI(f,VidBuf);                            // Now display the image
  37.  
  38.   fclose(f);                                    // Close image file   
  39.   getch();                                      // Wait for user to catch up
  40.   closegraph();                                 // Shut down graphics mode
  41.  
  42. }
  43.  
  44.